package cn.clwxy.gdz.dao;

import org.apache.commons.dbutils.handlers.ScalarHandler;

import cn.clwxy.gdz.entity.Img;
import cn.clwxy.gdz.util.BaseDao;

public class ImgDaoImpl extends BaseDao implements ImgDao{

	@Override
	public int addImg(Img img) {
		String sql="INSERT INTO imgid(src)value(?)";
		return super.update(sql, img.getSrc());
	}

	@Override
	public int deleteImg(Img img) {
		String sql="DELETE from imgid WHERE id=?";
		return super.update(sql, img.getId());
	}

	@Override
	public Integer getImgIdBySrc(String src) {
		String sql="SELECT id from imgid WHERE src=?";
		Long longId= super.queryColumn(sql, new ScalarHandler(), src);
		 return longId.intValue();
	}
	
}
